<?php

namespace Kunfeng\Dify\Event;

/**
 * 工作流开始事件
 */
class WorkflowStartedEvent extends BaseEvent
{
    private $workflowId;
    private $taskId;
    private $data;

    public function __construct(
        string $event,
        array $data = []
    ) {
        parent::__construct($event, $data);
        
        $this->workflowId = $data['workflow_id'] ?? '';
        $this->taskId = $data['task_id'] ?? '';
        $this->data = $data['data'] ?? [];
    }
    /**
     * 从数组创建事件
     */
    public static function fromArray(array $data)
    {
        return new self($data['event'] ?? 'event', $data);
    }

    public function getWorkflowId(): string
    {
        return $this->workflowId;
    }

    public function getTaskId(): string
    {
        return $this->taskId;
    }

    public function getData(): array
    {
        return $this->data;
    }
}
